# Maintainer: Justin Kromlinger <hashworks@archlinux.org>

pkgname=go-ethereum
pkgver=1.11.6
_commit=ea9e62ca3db5c33aa7438ebf39c189afd53c6bf8
pkgrel=1
pkgdesc='Official Go implementation of the Ethereum protocol'
arch=('loong64' 'x86_64')
url='https://geth.ethereum.org/'
license=('GPL3')
depends=('glibc')
makedepends=('git' 'go')
provides=('geth')
conflicts=('geth')
replaces=('geth')
source=("git+https://github.com/ethereum/go-ethereum.git#commit=${_commit}"
        'geth-user.service')
sha256sums=('SKIP'
            '806ab43221f0c203e663a78afced694786a5adb033f06fab07d07904384d7645')

build() {
    cd ${pkgname}

    export CGO_LDFLAGS="${LDFLAGS}"
    export GOFLAGS="-buildmode=pie"
    make all
}

package() {
    cd ${pkgname}

    install -Dm755 -t "${pkgdir}"/usr/bin build/bin/*
    install -Dm644 ../geth-user.service \
        "${pkgdir}/usr/lib/systemd/user/geth.service"
}
